package com.jp.knowledge.my.activity;

import android.view.View;
import android.widget.CheckBox;
import android.widget.TextView;

import com.jp.knowledge.R;
import com.jp.knowledge.comm.SlidingActivity;
import com.jp.knowledge.my.util.MyUtil;

import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;

/**
 * 我的竞品说角色
 *
 * @author gzejia 978862664@qq.com
 */
public class MyRoleActivity extends SlidingActivity {

    @ViewInject(R.id.my_role_cb_agree)
    private CheckBox mAgreeCb;

    @ViewInject(R.id.my_role_tv_agree)
    private TextView mAgreeTv;

    @ViewInject(R.id.my_role_tv_agree_content)
    private TextView mAgreeContentTv;

    @Override
    protected int getResourceId() {
        return R.layout.activity_my_role;
    }

    @Override
    protected void init() {
        initOthers();
        initTitle();
    }

    @Event(value = {R.id.my_role_btn_request, R.id.icon_left}, type = View.OnClickListener.class)
    private void onClick(View view) {
        switch (view.getId()) {
            case R.id.my_role_btn_request:// 申请认证
                break;
            case R.id.icon_left:// 返回
                finish();
                break;
        }
    }

    private void initTitle() {
        topName.setText(R.string.my_role_tv_title);
        topDesc.setVisibility(View.GONE);
        leftIcon.setImageResource(R.mipmap.arrow_white_left);
        rightIcon.setVisibility(View.GONE);
    }

    private void initOthers() {
        String agreeStr = getString(R.string.identify_tv_agree);
        String agreeContentStr = getString(R.string.identify_tv_agree_content);
        int blueColorRes = getResources().getColor(R.color.theme_color);
        mAgreeTv.setText(MyUtil.changeTextColor(agreeStr,
                blueColorRes, agreeStr.indexOf("《"), agreeStr.lastIndexOf("》") + 1));
        mAgreeContentTv.setText(MyUtil.changeTextColor(agreeContentStr,
                blueColorRes, agreeContentStr.indexOf("0"), agreeContentStr.lastIndexOf("2") + 1));
    }
}
